# -*- coding: utf-8 -*-
"""
@Time : 2024/10/27 22:25
@Author : 仰望天空的蜗牛
@Email : middlegod@sina.com
@File : speaker.py
"""
import pyttsx3

engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
    if 'Chinese' in voice.name:
        engine.setProperty('voice', voice.id)
        break
engine.setProperty('rate', 180)
engine.setProperty('volume', 2.0)


def speaker(text):
    engine.say(text)
    engine.runAndWait()
